using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class UI_CraftItemListSlot : MonoBehaviour
{
    private Inventory_Item item;
    [SerializeField] private Image itemIcon;
    [SerializeField] private TextMeshProUGUI itemName;

    [SerializeField] private UI_CraftPreview craftPreview;

    public void UpdateSlot(ItemDataSO itemData)
    {
        item = new(itemData);
        itemIcon.sprite = itemData.itemIcon;
        itemName.text = itemData.itemName;
    }
    
    public void UpdateCraftPreview()
    {
        craftPreview.UpdatePreview(item);
        craftPreview.UpdateAllMaterialSlots();
    }
}
